home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / misc / math / prime_2.lha / prime_2.readme < prev   
Text File  |  1996-03-09  |  3KB  |  71 lines

  1. author:  Gerd Wieczorek
  2. SMail:   Berliner Str.1
  3.          14959 Trebbin
  4.          BRD
  5.  
  6. EMail:   gwieifjc@sp.zrz.tu-berlin.de
  7.          (1x wöchentlich kontrolliert)
  8.  
  9. program: Prime (version 2)
  10.  
  11. This short program calculates all primnumbers until a given end is reached
  12. and writes them to the shell. The output can be redirected in a file with
  13. a normal "> file".
  14. Prime uses the algorithm of Eratosthenes ( Sieve of ~ ). It requires a
  15. processor >= 68020, if your Amiga contains a fpu you can use the special
  16. version. This means: prime_020 for Amiga without fpu, prime_020_881 for
  17. Amiga with fpu.
  18.  
  19. Prime is only usable from a shell.
  20. It uses the folloing options:
  21.  Prime MAX/A/N,BigBuffer=BB/S,NOOUTPUT=NO/S
  22.  
  23. Meanings of the options:
  24.  MAX        -   search for primnumbers until this number is reached
  25.  BIGBUFFER  -   prime uses a bigger internal buffer for the output
  26.                 normal: 8 KByte, with BB: 256 KByte
  27.  NOOUTPUT   -   prime produces no output, its only useful for measering the
  28.                 time of the calculation-loop
  29.  
  30. The command can be interrupted with CTRL-C. But be careful: using a big
  31. buffer without redirection could take a long time, before the output stops !
  32. ( because the entire buffer is written via DOS-Write )
  33.  
  34. Time needed by prime:
  35.  
  36. On my Amiga (A500, 68030/14MHz, 68882/20MHz, 4/1 MB) the sequence
  37. "Prime MAX BIGBUFFER >ram:prime.txt" needs these times:
  38.  
  39. MAX       10000 50000 100000 500000 1000000 2000000 3000000 4000000
  40. time (s)    0.2   0.7    1.2    5.5    10.7    21.5    31.9    43.0
  41.  
  42. The times for the old version (prime.lha) were to small - by a factor of 3.
  43. So here are the correct values:
  44.  
  45. MAX       10000 50000 100000 500000 1000000 2000000 3000000 4000000
  46. time (s)    0.7   2.3    4.4   19.4    37.0    70.0   100.0   130.0
  47.  
  48. As you could see, prime (v2) is roughly 3 times faster. This was made
  49. possible by the replacement of the RawDoFmt-call with a self programmed
  50. int->ascii conversion-routine. All other things remained.
  51.  
  52. Prime works with VMM and uses the virtual memory. It needs ca. MAX/8 in Kbyte
  53. plus the output-buffer of 8 or 256 Kbyte.
  54. Because of the heavy memory access virtual memory slows down the calculation
  55. significantly. The use of the processor cache is helpful, it speeds up the
  56. program by 35% with my 68030. The length of the written textfile can be esti-
  57. mated with ca. MAX bytes for MAX<100000, else roughly 0.6*MAX bytes.
  58.  
  59. If you have any questions, remarks, suggestions or bug reports please
  60. let me know. If you have no remarks, then you should drop me a little
  61. e-mail with your speed-results from prime.
  62.  
  63. Disclaimer:
  64. The entire risk as to the use of the program and the information presented
  65. is assumed by the user. In no event will I be liable for any damage resulting
  66. from any claim arising of the use of the program or the information presented
  67. herein, even if I have been advised of the possibilities of such damages.
  68. If anyone wants to include prime into another archive, he should send me
  69. an e-mail before.
  70.  
  71.